package org.ljy.springredis.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class TestController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @RequestMapping("/test01")
    public String test01() {
        ValueOperations<String, String> redis = redisTemplate.opsForValue();
        redis.set("test01", "test01");
        System.out.println(redis.get("test01"));
        return redis.get("test01");
    }
}
